﻿using PDFDesign.Model;

namespace PDFDesign.ViewModel
{
    public class RowViewModel : BaseViewModel
    {
        public RowViewModel(Row row)
        {
            Row = row;
            type = row.Type;
            multHeader = row.MultHeader;
            fixedRowHeight = row.FixedRowHeight;
            height = row.Height;
        }

        public Row Row { get; set; }

        public void Save()
        {
            Row.Type = type;
            Row.MultHeader = multHeader;
            Row.Height = height;
            Row.FixedRowHeight = fixedRowHeight;
        }

        private RowType type = RowType.normal;
        public RowType Type
        {
            get => type;
            set
            {
                type = value;
                OnPropertyChanged("Type");
            }
        }

        private bool multHeader;
        public bool MultHeader
        {
            get => multHeader;
            set
            {
                multHeader = value;
                OnPropertyChanged("MultHeader");
            }
        }

        private bool fixedRowHeight;
        public bool FixedRowHeight
        {
            get => fixedRowHeight;
            set
            {
                fixedRowHeight = value;
                OnPropertyChanged("FixedRowHeight");
            }
        }

        private double height;
        public double Height
        {
            get => height;
            set
            {
                height = value;
                OnPropertyChanged("Height");
            }
        }
    }
}
